#include <iostream>
#include <unistd.h>

using namespace std;
int main(){
  pid_t id=fork();
  if(id<0) return 0;
  if(id==0)
  {
    while(1){
	std::cout<<"I am child,pid:"<<getpid()<<std::endl;
  	sleep(1);
    }
  }
  else {
	int cnt=5;
	while(cnt--){
		std::cout<<"I am father,pid"<<getpid()<<std::endl;
		sleep(1);
	}	
	std::cout<<"father exit!"<<std::endl;
	exit(0);
  } 
  return 0;
}
